<?php $__env->startSection('content'); ?>
<div class="container">
    <div class="row justify-content-center">




<ul class="list-unstyled booklist">


		<li class="media">
		    <a href="<?php echo e(route('books.edit',['book'=>$book->id])); ?>"><img class="mr-3" src="<?php echo e($book->cover); ?>" style="width:100px;" alt="Generic placeholder image"></a>
		    <div class="media-body">
		      <h5 class="mt-0 mb-1"><a href="<?php echo e(route('books.edit',['book'=>$book->id])); ?>"><?php echo e($book->name); ?> </a><span>作者：<i><?php echo e($book->user->name); ?></i></span></h5>
		      <?php echo e($book->description); ?>

		    </div>
		</li>        
		
	  		
  		
</ul>

<?php if($book->chapters && count($book->chapters)>0): ?>
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
          <div class="sidebar-sticky">
            <ul class="nav flex-column">
        <?php $__currentLoopData = $book->chapters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $chapter): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <li class="nav-item"><a class="nav-link <?php if($chapter->id == $current_chapter->id): ?> hover <?php endif; ?>" href="<?php echo e(route('book_chapter.edit',['chapter'=>$chapter->id])); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"></path><polyline points="13 2 13 9 20 9"></polyline></svg><?php echo e($chapter->name); ?></a></li>
            <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mb-1 text-muted">
              <span></span>
              <a class="d-flex align-items-center text-muted" href="<?php echo e(route('posts.create',['chapter'=>$chapter->id])); ?>">
                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg>
              </a>
            </h6>

            <?php if($chapter->posts && count($chapter->posts)>0): ?>
                <ul class="nav flex-column mb-2 ml10">              
                <?php $__currentLoopData = $chapter->posts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $post_item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li class="nav-item"><a class="nav-link" href="<?php echo e(route('posts.edit',['chapter'=>$chapter->id,'post'=>$post_item->id])); ?>"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg><?php echo e($post_item->name); ?></a></li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </ul>
            <?php endif; ?>

            
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </ul>
</div>
</nav>
<?php endif; ?>

<div class="col-md-8">
<div class="card">
                <div class="card-header"><?php echo e(__('Edit Chapter')); ?></div>

                <div class="card-body">
                    <form method="POST" action="<?php echo e(route('book_chapter.update',['chapter'=>$current_chapter->id])); ?>">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('PUT'); ?>
                        <div class="form-group row">
                            <label for="name" class="col-md-4 col-form-label text-md-right"><?php echo e(__('Name')); ?></label>

                            <div class="col-md-6">
                                <input id="name" type="text" class="form-control<?php echo e($errors->has('name') ? ' is-invalid' : ''); ?>" name="name" value="<?php echo e($current_chapter->name); ?>" required autofocus>

                                <?php if($errors->has('name')): ?>
                                    <span class="invalid-feedback">
                                        <strong><?php echo e($errors->first('name')); ?></strong>
                                    </span>
                                <?php endif; ?>
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-6 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    <?php echo e(__('Update')); ?>

                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
</div>




    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>